package com.frame.work.common.constant;

/**
 * @Author zhanghui
 * @Date: 2021/07/05/16:28
 * @Description: 智能空调面板的常量
 */
public class ZhiNengKongTiaoMianBanConstant {
    /**
     * 空调面板模式
     */
    public enum AirConditionModeEnum {
        /**
         * 打开
         */
        OPEN("OPEN", "01"),

        /**
         * 关闭
         */
        CLOSE("CLOSE", "02"),

        /**
         * 制冷模式
         */
        COLD("COLD", "03", "制冷"),

        /**
         * 制冷模式
         */
        COOL("COOL", "03", "制冷"),

        /**
         * 制热模式
         */
        HEAT("HEAT", "04", "制热"),

        /**
         * 除湿模式
         */
        DEHUMIDIFICATION("DEHUMIDIFICATION", "05", "除湿"),

        /**
         * 送风
         */
        FAN("FAN", "06", "送风");

        private String name;
        private String value;
        private String content;

        AirConditionModeEnum(String name, String value) {
            this.name = name;
            this.value = value;
        }

        AirConditionModeEnum(String name, String value, String content) {
            this.name = name;
            this.value = value;
            this.content = content;
        }

        /**
         * 默认COLD
         *
         * @param value
         * @return
         */
        public static String getNameByValue(String value) {
            AirConditionModeEnum[] values = AirConditionModeEnum.values();
            for (AirConditionModeEnum airCondition : values) {
                if (airCondition.value.equals(value)) {
                    return airCondition.name;
                }
            }
            return AirConditionModeEnum.COLD.name;
        }

        /**
         * 获取空调状态
         *
         * @param value
         * @return
         */
        public static String getContentByValue(String value) {
            AirConditionModeEnum[] values = AirConditionModeEnum.values();
            for (AirConditionModeEnum airCondition : values) {
                if (airCondition.value.equals(value)) {
                    return airCondition.content;
                }
            }
            return AirConditionModeEnum.COLD.content;
        }

        /**
         * 默认03（COLD）
         *
         * @param name
         * @return
         */
        public static String getValueByName(String name) {
            AirConditionModeEnum[] values = AirConditionModeEnum.values();
            for (AirConditionModeEnum airCondition : values) {
                if (airCondition.name.equals(name)) {
                    return airCondition.value;
                }
            }
            return AirConditionModeEnum.COLD.value;
        }
    }

    /**
     * 空调面板风速
     */
    public enum AirConditionFanSpeedEnum {
        /**
         * 低风速
         */
        LOW("LOW", "02", "低风"),

        /**
         * 中风速
         */
        MID("MID", "03", "中风"),

        /**
         * 高风速
         */
        HIGH("HIGH", "04", "高风"),

        /**
         * 自动
         */
        AUTO("AUTO", "05", "自动");

        private String name;
        private String value;
        private String content;

        AirConditionFanSpeedEnum(String name, String value) {
            this.name = name;
            this.value = value;
        }

        AirConditionFanSpeedEnum(String name, String value, String content) {
            this.name = name;
            this.value = value;
            this.content = content;
        }

        /**
         * 通过value获取name，默认自动
         *
         * @param value
         * @return
         */
        public static String getNameByValue(String value) {
            AirConditionFanSpeedEnum[] values = AirConditionFanSpeedEnum.values();
            for (AirConditionFanSpeedEnum airConditionFanSpeedEnum : values) {
                if (airConditionFanSpeedEnum.value.equals(value)) {
                    return airConditionFanSpeedEnum.name;
                }
            }
            return AirConditionFanSpeedEnum.AUTO.name;
        }

        /**
         * 获取风速通过风速值
         *
         * @param value
         * @return
         */
        public static String getContentByValue(String value) {
            AirConditionFanSpeedEnum[] values = AirConditionFanSpeedEnum.values();
            for (AirConditionFanSpeedEnum airConditionFanSpeedEnum : values) {
                if (airConditionFanSpeedEnum.value.equals(value)) {
                    return airConditionFanSpeedEnum.content;
                }
            }
            return AirConditionFanSpeedEnum.AUTO.content;
        }

        /**
         * 通过name获取value，默认05（自动）
         *
         * @param name
         * @return
         */
        public static String getValueByName(String name) {
            AirConditionFanSpeedEnum[] values = AirConditionFanSpeedEnum.values();
            for (AirConditionFanSpeedEnum airConditionFanSpeedEnum : values) {
                if (airConditionFanSpeedEnum.name.equals(name)) {
                    return airConditionFanSpeedEnum.value;
                }
            }
            return AirConditionFanSpeedEnum.AUTO.value;
        }
    }

    public enum FreshAirFanSpeed {
        /**
         * 低风速
         */
        LOW("LOW", "02"),

        /**
         * 中风速
         */
        MID("MID", "03"),

        /**
         * 高风速
         */
        HIGH("HIGH", "04");

        private String name;
        private String value;

        FreshAirFanSpeed(String name, String value) {
            this.name = name;
            this.value = value;
        }

        /**
         * 默认02（低速）
         *
         * @param value
         * @return
         */
        public static String getNameByValue(String value) {
            FreshAirFanSpeed[] values = FreshAirFanSpeed.values();
            for (FreshAirFanSpeed freshAirFanSpeed : values) {
                if (freshAirFanSpeed.value.equals(value)) {
                    return freshAirFanSpeed.name;
                }
            }
            return FreshAirFanSpeed.LOW.name;
        }

        /**
         * 默认低速
         *
         * @param name
         * @return
         */
        public static String getValueByName(String name) {
            FreshAirFanSpeed[] values = FreshAirFanSpeed.values();
            for (FreshAirFanSpeed freshAirFanSpeed : values) {
                if (freshAirFanSpeed.name.equals(name)) {
                    return freshAirFanSpeed.value;
                }
            }
            return FreshAirFanSpeed.LOW.value;
        }
    }
}
